<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../../../plugin/layui/css/layui.css">
    <link rel="stylesheet" href="../../../plugin/ztree/css/metroStyle/metroStyle.css">
    <script type="text/javascript" src="../../../plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="../../../plugin/layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../plugin/ztree/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="../../../plugin/ztree/js/jquery.ztree.excheck.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../../plugin/tools/tool.js"></script>
</head>

<body>
<div class="x-body">
    <form class="layui-form layui-form-pane" style="margin-left: 20px;" lay-filter="myform">
        <input name="id" id="id" type="hidden">
        <div style="width:100%;height:400px;overflow: auto;">
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
                    <legend style="font-size:16px;">迭代名称</legend>
                </fieldset>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <label id="name"></label>
                </div>
                <div class="layui-input-inline">
                    <label id="startDateText"></label> - <label id="endDateText"></label>
                </div>
            </div>
            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
                    <legend style="font-size:16px;">迭代目标</legend>
                </fieldset>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <div id="content" class="layui-input-inline" style="width: 900px;margin-left: 0px;"></div>
                </div>
            </div>


            <div class="layui-form-item">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
                    <legend style="font-size:16px;">处理迭代</legend>
                </fieldset>
            </div>
            <div class="layui-form-item" style="width: 280px;">
                <select id="status" name="status">
                    <option value="0">新建</option>
                    <option value="1">处理中</option>
                    <option value="2">已完成</option>
                </select>
            </div>

        </div>
        <div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;position: fixed;bottom: 1px;margin-left:-20px;">
            <div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
                <button class="layui-btn layui-btn-normal" lay-filter="update" lay-submit>
                    确定
                </button>
                <button class="layui-btn layui-btn-primary" id="close">
                    取消
                </button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'layer', 'layedit'], function () {
        $ = layui.jquery;
        var form = layui.form;
        var layer = layui.layer;

        var data = window.parent.data;
        $("#id").val(data.id);
        $("#name").html(data.name);
        $("#content").html(data.content);
        $("#startDateText").html(data.startDateText);
        $("#endDateText").html(data.endDateText);
        $("#status").val(data.status);

        // 渲染
        form.render();

        $('#close').click(function (){
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });

        //监听提交
        form.on('submit(update)', function (data) {
            $.post('../../../pdms/iteration/update', data.field, function (data) {
                window.parent.layui.table.reload('list'); // 刷新表格
                layer.msg('处理成功');
                // 关闭窗口
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });

            return false;
        });
    });
</script>
</body>

</html>
